<template>
  <div class="quick-actions">
    <div class="action-group" v-for="group in actionGroups" :key="group.title">
      <div class="group-title">{{ group.title }}</div>
      <div class="action-list">
        <div 
          v-for="action in group.actions"
          :key="action.text"
          class="action-item"
          @click="handleAction(action)"
        >
          <el-icon class="action-icon"><component :is="action.icon" /></el-icon>
          <div class="action-content">
            <div class="action-label">{{ action.label }}</div>
            <div class="action-text">{{ action.text }}</div>
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { 
  DataAnalysis, TrendCharts, Document, Money,
  ShoppingCart, User, Setting, Search
} from '@element-plus/icons-vue'

const emit = defineEmits(['action'])

const actionGroups = ref([
  {
    title: '数据分析',
    actions: [
      {
        label: '销售分析',
        text: '帮我分析最近一个月的销售数据，包括销售趋势、热门商品和区域分布',
        icon: DataAnalysis
      },
      {
        label: '库存分析',
        text: '分析当前库存状况，找出库存积压和缺货的商品',
        icon: TrendCharts
      },
      {
        label: '财务分析',
        text: '分析本月的财务状况，包括收入、支出和利润情况',
        icon: Money
      }
    ]
  },
  {
    title: '业务操作',
    actions: [
      {
        label: '创建订单',
        text: '帮我创建一个新的销售订单',
        icon: ShoppingCart
      },
      {
        label: '查找商品',
        text: '查找价格在100-500元之间的商品',
        icon: Search
      },
      {
        label: '员工管理',
        text: '查看所有员工的考勤情况',
        icon: User
      }
    ]
  },
  {
    title: '系统配置',
    actions: [
      {
        label: '系统设置',
        text: '帮我查看系统的基本配置信息',
        icon: Setting
      },
      {
        label: '生成报告',
        text: '生成一份月度业务报告',
        icon: Document
      }
    ]
  }
])

const handleAction = (action) => {
  emit('action', action)
}
</script>

<style scoped lang="scss">
.quick-actions {
  padding: 16px;
}

.action-group {
  margin-bottom: 24px;
}

.group-title {
  font-size: 14px;
  font-weight: 600;
  color: #303133;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e5e5e5;
}

.action-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.action-item {
  display: flex;
  gap: 12px;
  padding: 12px;
  border: 1px solid #e5e5e5;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  
  &:hover {
    border-color: #409EFF;
    background: #f0f9ff;
  }
}

.action-icon {
  font-size: 20px;
  color: #409EFF;
  flex-shrink: 0;
}

.action-content {
  flex: 1;
}

.action-label {
  font-size: 14px;
  font-weight: 500;
  color: #303133;
  margin-bottom: 4px;
}

.action-text {
  font-size: 12px;
  color: #909399;
  line-height: 1.5;
}
</style>
